package io.xccit.order.interceptor;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.stereotype.Component;

import java.util.UUID;

/**
 * @author CH_ywx
 * @version 1.0
 * @create 2025/6/2
 * <p>XToken请求拦截器</p>
 */
@Component
public class XTokenRequestInterceptor implements RequestInterceptor {
    @Override
    public void apply(RequestTemplate requestTemplate) {
        // 设置X-Token请求头，值为随机生成的UUID字符串
        String xtoken = UUID.randomUUID().toString();
        requestTemplate.header("X-Token", xtoken);
        System.out.println("X-TokenRequestInterceptor:" + xtoken);
    }
}
